package apiwork.bean;

import java.lang.reflect.Method;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.linkage.util.log.Logger;


public abstract class IBean {
	private final Logger logger = Logger.getLogger(IBean.class);
	private ICtrlBean ctrlBean = new ICtrlBean();

	private String process_result = "";
	private String process_result_message = "";

	private String fillField = "";
	private String querylist = "";// zhaigx add

	public String toString() {
		// String retStr = "{ Class:";
		// Class c = this.getClass();
		// retStr += c.getName();
		// Method[] methods = c.getMethods();
		// for (Method method : methods) {
		// String methodName = method.getName();
		// if (methodName.equals("getClass")) {
		//
		// } else if (methodName.startsWith("get")) {
		// retStr += " , " + methodName.substring(3, 4).toLowerCase()
		// + methodName.substring(4) + ":";
		// try {
		// retStr += method.invoke(this, new Object[0]);
		// } catch (Exception e) {
		// }
		// } else if (methodName.startsWith("is")) {
		// retStr += " , " + methodName.substring(2, 3).toLowerCase()
		// + methodName.substring(3) + ":";
		// try {
		// retStr += method.invoke(this, new Object[0]);
		// } catch (Exception e) {
		// }
		// }
		// }
		// retStr += " }";
		// return retStr;
		return ToStringBuilder.reflectionToString(this);// zhaigx

	}

	public String getFillField() {
		return fillField;
	}

	public void setFillField(String fillField) {
		String split = ",";
		if (this.fillField.trim().equals(""))
			this.fillField = fillField;
		else {
			String[] fillArray = this.fillField.split(split);
			for (String str : fillArray) {
				if (str.trim().equals(fillField.trim()))
					return;
			}
			this.fillField += split + fillField;
		}
	}

	public ICtrlBean getCtrlBean() {
		if (null == ctrlBean) {
			ctrlBean = new ICtrlBean();
		}
		return ctrlBean;
	}

	public void setCtrlBean(ICtrlBean ctrlBean) {
		this.ctrlBean = ctrlBean;
	}

	public String getProcess_result() {
		return process_result;
	}

	public void setProcess_result(String process_result) {
		this.process_result = process_result;
	}

	public String getProcess_result_message() {
		return process_result_message;
	}

	public void setProcess_result_message(String process_result_message) {
		this.process_result_message = process_result_message;
	}

	public String getQuerylist() {
		return querylist;
	}

	public void setQuerylist(String querylist) {
		this.querylist = querylist;
	}

}
